<?php
include_once "xAP-functions/webincludes.php";
echo webpageheader();


$now=date("Y-m-d H:i:s",(time()-1800));
$channelid=intval($_GET["id"]);

$sql="select xAP_TV_Prog.ChannelName,xAP_TV_Prog.ProgName,xAP_TV_Prog.ProgStart,xAP_TV_Prog.ProgEnd,
xAP_TV_Channel.ChannelAlias ,xAP_TV_Prog.ProgDesc
from xAP_TV_Prog 
INNER JOIN xAP_TV_Channel on xAP_TV_Channel.ChannelName=xAP_TV_Prog.ChannelName

where ProgEnd>'".$now."' and xAP_TV_Channel.ChannelID='".$channelid."'
order by xAP_TV_Prog.ProgStart
limit 50
";
$results=dbquery($sql);

//display
echo "<Table width=100%>";
foreach($results as $row){
//grey out old items
if(strtotime($row["ProgEnd"])<time()){$bg=" greytext";}else{$bg="";}

echo "<tr>
<TD><img src='images/channels/".$row["ChannelName"].".jpg' height=50 width=66></td>

<TD align=center class='boldtext$bg'>".date("H:i",strtotime($row["ProgStart"]))."<BR>
".date("H:i",strtotime($row["ProgEnd"]))."
</td>
<TD class='normaltext$bg'>".$row["ProgName"]."<BR>
".$row["ProgDesc"]."</td>
</tr>

<tr bgcolor='#aaaaaa'><td colspan=100></td></tr>
";

}
echo "</table>";

echo webpagefooter();
?>